using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GetNSMBoneOffset : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Transform[] father = this.GetComponentsInChildren<Transform>();
        Transform lhip=null, lknee=null, lankle = null;
        foreach (var child in father)
        {
            if (child.name.Equals("LeftHip"))
            {
                lhip = child;
            }
            
            if (child.name.Equals("LeftKnee"))
            {
                lknee = child;
            }
            
            if (child.name.Equals("LeftAnkle"))
            {
                lankle = child;
            }
        }

        if (lhip != null && lknee != null && lankle != null)
        {
            float unity_leftleg =
                Vector3.Distance(lhip.GetWorldMatrix().GetPosition(), lknee.GetWorldMatrix().GetPosition()) +
                Vector3.Distance(lknee.GetWorldMatrix().GetPosition(), lankle.GetWorldMatrix().GetPosition());
            Debug.Log("====>"+unity_leftleg);
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
